﻿/*----------------------------------------------------------------
//  <copyright file="IUserClaimsProvider.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-12-28 11:33</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Authentication
{
    #region "用户 Claims 提供器"
    /// <summary>
    /// 用户 Claims 提供器
    /// </summary>
    public interface IUserClaimsProvider
    {
        #region "方法"
        #region "创建用户标识"
        /// <summary>
        /// 创建用户标识
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <returns></returns>
        Task<Claim[]> CreateClaims(string userId);
        #endregion
        #region "处理用户当前组织机构声明"
        /// <summary>
        /// 处理用户当前组织机构声明
        /// </summary>
        /// <param name="claims">声明集合</param>
        /// <param name="organizationId">组织机构编号</param>
        /// <returns></returns>
        Task<Claim[]> HandleCurrentOrganizationClaims(IEnumerable<Claim> claims, string organizationId = "");
        #endregion
        #region "请求的Token验证成功后使用OnlineUser信息刷新Identity，将在线用户信息赋予Identity"
        /// <summary>
        /// 请求的Token验证成功后使用OnlineUser信息刷新Identity，将在线用户信息赋予Identity
        /// </summary>
        /// <param name="identity">待刷新的Identity</param>
        /// <returns>刷新后的Identity</returns>
        Task<OperationResult<ClaimsIdentity>> RefreshIdentity(ClaimsIdentity identity);
        #endregion

        #endregion

    }
    #endregion

}
